package com.loe.httptest

import android.os.Bundle
import com.loe.mvp.BaseActivity
import com.loe.mvp.ext_java.delay
import kotlinx.android.synthetic.main.activity_http_setting.*

class HttpSettingActivity : BaseActivity()
{
    override fun onCreate(savedInstanceState: Bundle?)
    {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_http_setting)

        initView()
        initEvent()
    }

    override fun initView()
    {
        formBaseUrl.text = SpHttpTest.baseUrl
        formTokenKey.text = SpHttpTest.tokenKey
        formTokenValue.text = SpHttpTest.token

        formBaseUrl.setTextListener()
        {
            SpHttpTest.baseUrl = it
        }
        formTokenKey.setTextListener()
        {
            SpHttpTest.tokenKey = it
        }
        formTokenValue.setTextListener()
        {
            SpHttpTest.token = it
        }
    }

    override fun initEvent()
    {
        titleView.setDelayRightListener()
        {
            toast("保存成功")
            delay(500)
            {
                finish()
            }
        }
    }
}